using System.Collections.Immutable;
using Microsoft.EntityFrameworkCore;
using WidgetsDesign.API.DataBase;
using WidgetsDesign.API.Models;

namespace WidgetsDesign.API.Services
{
    public class DictRepository:IDictRepository
    {
        private readonly AppDbContext _context;
        public DictRepository(AppDbContext context)
        {
            _context = context;
        }
        public async Task<List<Dict>> GetDictAsync(string key)
        {
            var query = from d in _context.DictData
                        where d.Key == key
                        orderby d.Sort
                        select d;
            var filteredData = await query.ToListAsync();
            return filteredData;
        }
    }
}
